package com.example.gitpart03;

import android.os.Bundle;
import android.widget.ListView;
import androidx.appcompat.app.AppCompatActivity;
import java.util.ArrayList;
import java.util.List;

public class ShouYeSecond extends AppCompatActivity {

    private ListView hotProductsList;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.shouye_second_page);

        // 找到 ListView
        hotProductsList = findViewById(R.id.hot_products_list);

        // 创建数据列表
        List<Product> productList = new ArrayList<>();
        // 添加一些示例产品
        productList.add(new Product("安姬果果杯", "￥19.8", R.drawable.yogurt_niuyouguo, "/份起"));
        productList.add(new Product("原味酸奶", "￥12.99", R.drawable.yogurt_yuanwei, "/份起"));

        // 创建适配器
        ProductAdapter adapter = new ProductAdapter(this, productList);
        // 设置适配器
        hotProductsList.setAdapter(adapter);
    }
}